﻿using System;
using System.Collections.Generic;

namespace RexToy.UI.WinForm.Pmlx
{
    public static class ExceptionHelper
    {
        public static void ThrowTemplateItemWrap(Exception ex)
        {
            throw new PmlxException("Error when invoke ITemplateItem.Parse, check inner exception.", ex);
        }

        public static void ThrowInvalidSchema(string uri)
        {
            throw new PmlxException(string.Format("Not a valid clr namespace: [{0}].", uri));
        }

        public static void ThrowInvalidStyleSheet()
        {
            throw new PmlxException("Only 1 uri attribute is allowed");
        }

        public static void ThrowAttributeHavePrefix(string prefix, string localName)
        {
            throw new PmlxException(string.Format("Can not set control attribute [{0}.{1}]", prefix, localName));
        }

        public static void ThrowLoadFail(string prefix, string localName)
        {
            throw new PmlxException(string.Format("Load type [{0}:{1}] fail.", prefix, localName));
        }

        public static void ThrowControlNotFound(string name)
        {
            throw new PmlxException(string.Format("Control name = [{0}] not found.", name));
        }

        public static void ThrowMultiControlFound(string name)
        {
            throw new PmlxException(string.Format("Multiple control name = [{0}] found.", name));
        }

        public static void ThrowResourceNotLoadYet()
        {
            throw new PmlxException("Resource not load yet. Are you forget to assgin uri attribute to Icon or Bitmap?");
        }
    }
}
